package com.slz3.business.module.memberManagement.memThirdLoginInfo.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.memberManagement.memThirdLoginInfo.domain.MemThirdLoginInfo;
import com.slz3.business.module.memberManagement.memThirdLoginInfo.domain.MemThirdLoginInfoFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class MemThirdLoginInfoTransactionalServiceImpl implements MemThirdLoginInfoTransactionalService {

    @Override
    public MemThirdLoginInfo modify(MemThirdLoginInfo memThirdLoginInfoNew) {
        Repositorys.memThirdLoginInfo.test();
        Repositorys.memThirdLoginInfo.save(MemThirdLoginInfoFactory.initBaseFields());
        System.err.println(1/0);
        memThirdLoginInfoNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.memThirdLoginInfo.saveAndFlush(memThirdLoginInfoNew);
    }

    @Override
    public List<MemThirdLoginInfo> batchModify(List<MemThirdLoginInfo> memThirdLoginInfoList) {
        return Repositorys.memThirdLoginInfo.saveAll(memThirdLoginInfoList);
    }
}
